package net.discard.controller;

import lombok.extern.slf4j.Slf4j;
import net.discard.model.domian.ResponseVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import static net.discard.model.domian.ResponseVo.FAILED;

@RestControllerAdvice
@Slf4j
public class ExceptionController {

    @ExceptionHandler({Throwable.class})
    public ResponseVo exception(Throwable th){
        log.error(th.getMessage(), th);
        return FAILED(th.getMessage());

    }

}
